home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / qbfaqr01.zip / NETID2.BAS < prev    next >
BASIC Source File  |  1992-08-10  |  2KB  |  81 lines

  1. '[Editor : You can just run the following code]
  2. 'Date: 05-22-92 (22:05)
  3. 'From: FRANK HAGAN
  4. 'Subj: Network Id's
  5. '------------------------------------------------------------------------
  6. '  ┌─────╢ MARTY KANE
  7. '  │Does anybody have a routine to check either the network node ID or the
  8. '  │card id on a NetBios based network, such as LanTastic?
  9.  
  10. 'There is a couple of things in Ethan Winer's book BASIC Techniques
  11. 'and Utilities (Ziff Davis Press, ISBN 1-56276-008-4).  First, an
  12. 'include file, REGTYPE.BI:
  13.  
  14.         TYPE RegType
  15.          AX    AS INTEGER
  16.          BX    AS INTEGER
  17.          CX    AS INTEGER
  18.          DX    AS INTEGER
  19.          BP    AS INTEGER
  20.          SI    AS INTEGER
  21.          DI    AS INTEGER
  22.          Flags AS INTEGER
  23.          DS    AS INTEGER
  24.          ES    AS INTEGER
  25.         END TYPE
  26.  
  27. 'Then, a short program fragment with three functions:
  28.  
  29. 'NETCHECK.BAS, identifies which network is running
  30.  
  31. DEFINT A-Z
  32. ''$INCLUDE: 'regtype.bi'
  33.  
  34. DIM SHARED Registers AS RegType
  35.  
  36. DECLARE FUNCTION NWThere% ()
  37. DECLARE FUNCTION BVThere% ()
  38. DECLARE FUNCTION MSThere% ()
  39.  
  40.  
  41. 'NOTE: Do not change the order in which these
  42. '      tests are performed.
  43.  
  44. PRINT "I think the network is ";
  45.  
  46. IF NWThere% THEN
  47.   PRINT "Novell Netware"
  48. ELSEIF BVThere% THEN
  49.   PRINT "Banyon Vines"
  50. ELSEIF MSThere% THEN
  51.   PRINT "Lantastic or other MS compatible"
  52. ELSE
  53.   PRINT "Something I don't recognize, or no network"
  54. END IF
  55.  
  56. FUNCTION BVThere% STATIC
  57. BVThere% = -1
  58. Registers.AX = &HD701
  59. CALL Interrupt(&H2F, Registers, Registers)
  60.   AL = Registers.AX AND 255
  61.   IF AL <> 0 THEN BVThere% = 0
  62. END FUNCTION
  63.  
  64. FUNCTION MSThere% STATIC
  65.   MSThere% = -1
  66.   Registers.AX = &HB800
  67.     CALL Interrupt(&H2F, Registers, Registers)
  68.     AL = Registers.AX AND 255
  69.     IF AL = 0 THEN MSThere% = 0
  70. END FUNCTION
  71.  
  72. FUNCTION NWThere% STATIC
  73.   NWThere% = -1
  74.   Registers.AX = &H7A00
  75.   CALL Interrupt(&H2F, Registers, Registers)
  76.     AL = Registers.AX AND 255
  77.     IF AL <> &HFF THEN NWThere% = 0
  78. END FUNCTION
  79. '----------------------------------------------------
  80. 'The book is a very good one; I heartily recommend it.
  81.